import { GameServer } from './core/Server';
import { Logger } from './core/utils/Logger';

const logger = new Logger();

async function main() {
    try {
        const server = GameServer.instance;
        await server.initialize();
        logger.info('Server started successfully');
    } catch (error) {
        logger.error('Failed to start server', error);
        process.exit(1);
    }
}

// 处理进程退出
process.on('SIGINT', async () => {
    logger.info('Received SIGINT. Graceful shutdown...');
    try {
        // TODO: 实现优雅关闭
        process.exit(0);
    } catch (error) {
        logger.error('Error during shutdown', error);
        process.exit(1);
    }
});

// 启动服务器
main(); 